#ifndef __COMMON_THREAD__
#define __COMMON_THREAD__

#include <vector>
#include <windows.h>
#include <iostream>

using namespace std;

const int THREAD_MANAGER_ERROR = -1;

class thread_manager
{
private:
	vector<HANDLE>		m_ThreadList;			
	CRITICAL_SECTION	m_CriticalSection;

public:
	thread_manager();
	~thread_manager();

	int CreateNewThread(LPTHREAD_START_ROUTINE lpStartAddress, LPVOID arg);

	void DestoryThread(int threadnumber);
	void DestoryAllThread();

	void WaitThread(int threadnumber);
	void WaitAllThread();

	void SetPriority(int ThreadNumber, int Priority);		
	int GetPriority(int ThreadNumber);				
};

#endif